<template>
    <div>
        <div>
            <p>
                <a href="https://tool.lu/ip/">IP签名图</a>
            </p>
            <img src="https://tool.lu/netcard/">
        </div>
        <p>wew11000001</p>
        <p>wew11</p>
        <div>
            <!-- 
                父向子传值主要通过的是 props 属性来传值
                这里的joTest就是 子组件里定义的属性
             -->
            <TodoItem :joTest="user"></TodoItem>
        </div>
        <el-button type="primary" size="default" @click="alterUserData">父组件修改子组件的数据</el-button>
        <p>wew11</p>
        <p>wew11</p>

        <span>{{weatherInfo.city}}天气：{{weatherInfo.wea+weatherInfo.tem2+'~'+weatherInfo.tem1}}度，{{weatherInfo.win+weatherInfo.win_speed}} </span>

        <p>wew11</p>
        <p>wew11</p>

        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
        <p>wew11</p>
    </div>
</template>

<script>
import TodoItem from "@/components/TodoItem.vue";
import originJSONP from "jsonp";
export default {
    name: "DefaultHome",
    components: {
        TodoItem
    },
    data() {
        return {
            weatherInfo:{},
            groceryList: [
                { id: 0, text: '蔬菜' },
                { id: 1, text: '奶酪' },
                { id: 2, text: '随便其它什么人吃的东西' }
            ],
            user: {
                id: 1,
                name: 'ieqa123wf',
                gender: '男'
            }
        }
    },
    mounted(){
        this.getWeather();

    },
    methods: {

        alterUserData() {
            this.user.id++;
        },

        getWeather() {
            let url3 = 'https://www.tianqiapi.com/api?version=v6&appid=85618448&appsecret=9ZfOvBsd&callback=ckp';
            let opts = {
                prefix: 'ckp'
            }
            //发起jsonP请求
            originJSONP(url3, opts, (err, data) => {
                console.log('????????????????===')
                if (!err) {
                    console.log(data);
                    this.weatherInfo = data;
                } else {
                    console.log(err)
                }
            });
        },
    }
}
</script>

<style scoped></style>